package com.yanqu.road.logic.pb;

import com.yanqu.road.entity.systemgroup.common.SystemServerGroupWeekData;
import com.yanqu.road.pb.union.SystemGroupMatchProto;

public class ServerSystemGroupPb {

    public static SystemGroupMatchProto.ServerSystemMatchGroupTemp.Builder parseMatchGroupTemp(SystemServerGroupWeekData matchGroup) {

        SystemGroupMatchProto.ServerSystemMatchGroupTemp.Builder builder = SystemGroupMatchProto.ServerSystemMatchGroupTemp.newBuilder();
        builder.setCrossServerId(matchGroup.getCrossId());
        builder.setGroupId(matchGroup.getGroupId());
        builder.setSystemId(matchGroup.getSystemId());
        builder.addAllServerId(matchGroup.getServerIdList());
        builder.setWeekId(matchGroup.getWeekId());
        builder.setOpenDay(matchGroup.getOpenDay());
        builder.setAddTime((int)(matchGroup.getAddTime().getTime()/1000));
        return builder;
    }

    public static SystemServerGroupWeekData parseMatchGroupTemp(SystemGroupMatchProto.ServerSystemMatchGroupTemp temp) {
        SystemServerGroupWeekData matchGroup = new SystemServerGroupWeekData();
        matchGroup.setCrossServerIdNeedSync(temp.getCrossServerId());
        matchGroup.setGroupId(temp.getGroupId());
        matchGroup.setSystemId(temp.getSystemId());
        matchGroup.setWeekId(temp.getWeekId());
        matchGroup.setServerIdList(temp.getServerIdList());
        matchGroup.setTime(temp.getAddTime());
        matchGroup.setOpenDay(temp.getOpenDay());
        return matchGroup;
    }
}
